<?php
/**
 * Created by PhpStorm.
 * User: yinnannan
 * Date: 16/1/19
 * Time: 上午5:15
 */
class activeconfig  {

   	public function insert($parm){

		DB::insert("sysactiveconfig",array('productId','activeId'))->values(array($parm['productId'],$parm['activeId']))->execute();
   	}
     public function delete($parm){

   		DB::delete('sysactiveconfig')->where('productId','=',$parm['id'])->execute();
	}

	public function getByProductIdAndActiveName($parm){
		
		$result = DB::select('sysactive.*')->from('sysactive')->join('sysactiveconfig')->on('sysactiveconfig.activeId',"=","sysactive.id")->where("sysactiveconfig.productId","=",$parm['productId'])->execute()->as_array();


		return $result;
	}
}